package hellfire.platform.graphics;

import hellfire.system.graphics.Shaders;

/**
 * Vertex shader codes start with 'v'.
 * Fragment shader codes start with 'f'.
 * Programs (vertex+fragment pairs) start with 'p'
 * @author Roma
 *
 */
public class PlatformShaders 
{	
	
	public final static String vSMARTATOM =
			"uniform mat4 uMVPMatrix;" +
			"attribute vec4 aPosition;" +
			"attribute vec2 aTexCoord;" +
			"varying vec2 vTexCoord;" +
			"void main() " +
			"{" +
			"   vTexCoord = aTexCoord;" +
			"	gl_Position = uMVPMatrix * aPosition;" +
			"}";
	
	public final static String fLord =
			"precision mediump float;" +
			"uniform vec4 uColor;" +
			"uniform vec4 uProgressColor;" +
			"uniform float uProgress;" +
			"uniform sampler2D uTexture;" + 
			"varying vec2 vTexCoord;" +
			"void main() " +
			"{" + 
			"   vec4 pxl = texture2D(uTexture, vTexCoord);" +
			"	float alpha = pxl[3];" +
			"	vec4 imgPxl = pxl * uColor;" + 
			"	float m = 2.0f*abs(mod(vTexCoord.x, 0.02f) - 0.01f); " + 
			//"	vec4 barPxl = uProgressColor * (1.0f - step(0.35f, alpha)) * step(0.1f, alpha);" +
			"	vec4 barPxl = uProgressColor * (1.0f - step(0.4f, alpha)) * step(0.1f, alpha) * step(0.2f, pxl.r) * (alpha+0.2f);" +
			"	gl_FragColor = imgPxl  + barPxl * (m*100.0f) * step(1.0f-uProgress, 1.0f-vTexCoord.x/0.7f);" +
			"}";
	
	
	public final static String[] pBar = { vSMARTATOM, fLord };// { Shaders.vSMARTATOM, Shaders.fPICASSO };
	
	public final static String[][] progList = { pBar }; 

}
